import os
from multiprocessing import Pool 


input_files = os.listdir("./11.cluster_result")

output_dir = "./12.llm_result"
os.makedirs(output_dir, exist_ok=True)


def exec(input,output):
    cmd = f"python 12.label_tree_concept_parent.py -input {input} -output {output}"
    os.system(cmd)
    
tasks = []
for file in input_files:
    input_file_path = os.path.join("./11.cluster_result", file)
    output_file_path = os.path.join("./12.llm_result", file.split(".")[0] + ".json")
    tasks.append((input_file_path, output_file_path))

# for i in tasks:
#     exec_llm(i[0], i[1])

with Pool(5) as pool:
    pool.starmap(exec, tasks)